import { defineStore } from "pinia"
import { computed, ref } from "vue"

export const useCountStore = defineStore(
  "counter",
  () => {
    const totalCount = ref(0)
    const num1 = ref(11)
    const num2 = ref(22)
    const doubleCount = computed(() => totalCount.value * 2)
    const addCount = () => totalCount.value++
    return { totalCount, doubleCount, addCount }
  },
  {
    // unistorage: true,
    unistorage: {
      key: "hm-counter",
      paths: ["totalCount"],
    },
  }
)
